<%@ page import="model.entity.product.Product.*"%>
<%@ page import="dao.AbstractDAO"%>
<%@ page import="dao.entity.ProductDAO"%>
<%@ page import="dao.JPAHiberDAOFactory"%>
<%@ page import="java.util.List"%>
<%@ page import=" model.entity.product.Product"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="headerLink.jsp"%>
<title>Danh Sach San pham</title>

<script type="text/javascript">
$(function() {
	var $container = $('#productContainer');
	$container.imagesLoaded(function(){
	  $container.masonry({
	    itemSelector : '.products-box'
	  });
	});
});
</script>
</head>
<body>


	<div id="nen">
		
		<jsp:include page="menuLeft.jsp"></jsp:include>		
			
		<div id="khungGiua">
			<jsp:include page="header.jsp"></jsp:include>
			
			<div style="clear: left;"></div>
			
			<div id="noiDung">

				<!-- khung chua hang -->
				<div id="khungSanPham">
					<!-- thanh ngang 1 -->
					<div id="danhSachSanPham" class="danhSachSanPhamTren">
						<ul>
							<li>
								<a href="#"></a>
							</li>
						</ul>
					</div>
					
					<!-- khung thoi trang nam -->
					<div id="thoiTrang">
					<div id="productContainer">
					<%
						List<Product> toanBo;
						toanBo = (List<Product>) session.getAttribute("filteredList");
						if (toanBo == null) toanBo = JPAHiberDAOFactory.getInstance().getProductDAO().selectAll();
						 else session.setAttribute("filteredList", null);
					for (Product sanpham: toanBo) {
					%>
						
						<div class="products-box slowTrans">
							<table>
								<tr>
									<td colspan="2">
										<img alt="No image" src="../<%=sanpham.getImage()%>">
									</td>
								<tr>
									<td colspan="2">
										<%=sanpham.getName()%>
									</td>
								</tr>
								<tr>
									<td>
										<span class="price"><%=sanpham.getPrice()%></span>
									</td>
									<td class="acctionGr">				
										<a rel="tooltip" title="Add to Cart" class="btn-cart slowTrans" onclick="addProductToCart(<%=sanpham.getProductId()%>);">&nbsp;</a>
										<a rel="tooltip" class="link-wishlist  slowTrans" title="Add to Wishlist">&nbsp;</a>
										<a rel="tooltip" class="link-compare  slowTrans" title="Add to Compare" href="ChiTietSanPham.jsp?idSP=<%=sanpham.getProductId()%>">&nbsp;</a>
									</td>
								</tr>
							</table>
						</div>
					<% } %>
						</div>
					
					</div>
					<div style="clear: left;"></div>
					<div id="danhSachSanPham" class="danhSachSanPhamDuoi">
						<ul>
							<li>
								<a href="#"></a>
							</li>
						</ul>
					</div>

				</div>


			</div>
			<!-- dong the noi dung -->

		</div>
		
			<!-- menu nu -->
			
				<jsp:include page="menuRight.jsp"></jsp:include>
			
		<div id="cartDiv" class="hideCart">
		<div id="thanhCart">
			<jsp:include page="cartModule.jsp"></jsp:include>
		</div>
		</div>
	</div>

</body>
</html>